package com.hp.tiger.chapter10;

import java.util.concurrent.TimeUnit;

/**
 * @author XavierDong
 **/
public class ThreadLocalSimpleTest {

    private static ThreadLocal<String> threadLocal = new ThreadLocal(){
        @Override
        protected Object initialValue() {
            return "Alex";
        }
    };

    /**
     * JVM start main thread
     */
    public static void main(String[] args) throws InterruptedException {
        threadLocal.set("ALex111");
        TimeUnit.SECONDS.sleep(1);
        String value = threadLocal.get();
        System.out.println(value);
        threadLocal.remove();
    }
}
